home *** CD-ROM | disk | FTP | other *** search
/ Belgian Amiga Club - ADF Collection / BS1 part 05.zip / BS1 part 5 / PDraw3.0.adf / pdraw_rex.lzh / SpacePoints.pdrx < prev    next >
Text File  |  1992-06-17  |  2KB  |  73 lines

  1. /*
  2. @N
  3.  
  4. This Genie will position two points in a bezier object at a precise distance apart.
  5. */
  6. counter = 0
  7. cr = '0a'x
  8. msg = PDSetup.rexx(2,0)
  9. units = getclip(pds_units)
  10. if msg ~= 1 then exit_msg(msg)
  11.  
  12. point1 = pdm_ClickOnPoint("Click on first point in object..")
  13. if point1 = '0 0' then exit_msg()
  14.  
  15. point2 = pdm_ClickOnPoint("Click on second point in object..")
  16. if point2 = '0 0' then exit_msg()
  17.  
  18. obj = word(point1, 1)
  19. if obj ~= word(point2, 1) then exit_msg("Points must be in same object")
  20. if ~isbezier(obj) then exit_msg("Object must be a bezier object")
  21.  
  22. pt1 = word(point1, 2)
  23. pt2 = word(point2, 2)
  24.  
  25. if pt2 < pt1 then
  26. do
  27.    temp = pt2
  28.    pt2  = pt1
  29.    pt1  = temp
  30. end
  31.  
  32. hspace = pdm_GetForm("Enter horizontal spacing..", 8, "Horizontal")
  33. if hspace = '' then exit_msg()
  34.  
  35. vspace = pdm_GetForm("Enter Vertical spacing..", 8, "Vertical")
  36. if vspace = '' then exit_msg()
  37.  
  38. if ~(datatype(hspace, n) & datatype(vspace, n)) then exit_msg("Invalid Entry")
  39.  
  40. fpos = pdm_GetPoint(obj, pt1)
  41. parse var fpos hpos ' ' vpos ' ' .
  42.  
  43. if pdm_Inform(2, "Flatten tangents?", "Yes", "No") then
  44. do cpoint = pt1 to pt2
  45.  
  46.    cpos = pdm_GetPoint(obj, cpoint)
  47.    parse var cpos cpx ' ' cpy ' ' .
  48.    
  49.    call pdm_MovePoint(obj, cpoint, hpos - cpx, vpos - cpy)
  50.    hpos = hpos + hspace
  51.    vpos = vpos + vspace
  52. end
  53. else
  54. do cpoint = pt1 to pt2
  55.  
  56.    call pdm_SetPoint(obj, cpoint, hpos" "vpos" 0 0 0 0")
  57.    hpos = hpos + hspace
  58.    vpos = vpos + vspace
  59. end
  60.  
  61.  
  62.  
  63. exit_msg()
  64.  
  65. exit_msg: procedure expose units
  66. do
  67.    parse arg message
  68.    
  69.    if message ~= '' then call pdm_Inform(1,message,)
  70.    call pdm_SetUnits(units)
  71.    call pdm_AutoUpdate(1)
  72.    exit
  73.  end